package com.xinshujia.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xinshujia.dao.AccelerationStatisticsDao;
import com.xinshujia.entity.AccelerationStatisticsEntity;
import com.xinshujia.service.AccelerationStatisticsService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * *************************************
 * *   @author: 野狼上校               **
 * *   @since: 2024-07-12 11:08       **
 * *   @version: 1.0                  **
 * *************************************
 * <p>
 *     设备振动数据实现类
 */
@Service
public class AccelerationStatisticsServiceImpl extends ServiceImpl<AccelerationStatisticsDao, AccelerationStatisticsEntity> implements AccelerationStatisticsService {
    private final AccelerationStatisticsDao accelerationStatisticsDao;

    public AccelerationStatisticsServiceImpl(AccelerationStatisticsDao accelerationStatisticsDao) {
        this.accelerationStatisticsDao = accelerationStatisticsDao;
    }

    /**
     * 实时获取振动值
     * @param: deviceGuid  设备Id
     * @param: count  获取数据条数
     */
    @Override
    public List<AccelerationStatisticsEntity> getASByDeviceGuid(String deviceGuid, int count) {
        return accelerationStatisticsDao.getAsByDeviceGuid(deviceGuid, count);
    }

    /**
     * 查询在线设备GUID （当前时间前10秒）
     */
    @Override
    public List<String> selectOnlineDeviceGuids() {
        return accelerationStatisticsDao.selectOnlineDeviceGuids();
    }
}
